﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetPE.Core.Metadata;
using NetPE.Core.Metadata.Heaps;

namespace NetPE.TreeNodes
{
    class MdStreamNode : BaseNode
    {
        public MdStreamNode(MetadataStream dat)
            : base(dat)
        {
            this.dat = dat;
            this.Text = dat.Name;
            this.ImageIndex = this.SelectedImageIndex = NodeType.Stream;
            if (dat.Type == MetadataStreamType.Tables)
            {
                this.Nodes.Add(new TblHdrNode(dat.Heap as TablesHeap));
                this.Nodes.Add(new TblsNode(dat.Heap as TablesHeap));
            }
        }

        MetadataStream dat;
        public override object Data { get { return dat; } }

        public override BaseEditor GetEditorControl()
        {
            return new StreamHexEditor();
        }
    }
}
